package blue_bridge_cup_learning.双指针;

import java.util.Scanner;
import java.util.HashSet;

public class 最长无重复字串 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        HashSet<Character> set = new HashSet<>();
        int l = 0, r = 0;
        int max = 0;
        set.add(s.charAt(0));
        for (int i = 1; i < s.length(); i++) {
            char ch = s.charAt(i);
            while (set.contains(ch)) {
                set.remove(s.charAt(l++));
            }
            set.add(ch);
            r++;
            max = Math.max(max, r - l + 1);
        }
        System.out.println(max);
    }
}
